import { useAuthStore2 } from '../store/useAuthStore2';
import useSWR from 'swr';
import { getCDOCOrderApi } from '../api/supplyChainNetwork';

export const useOrderList = () => {
	const token = useAuthStore2(s => s.token);
	const { data, error, isLoading } = useSWR(
		() => (token ? '/screen/businessIndicator/queryCdocOrderList' : null),
		getCDOCOrderApi,
		{
			refreshInterval: 1000 * 60
		}
	);
	return {
		data: data,
		isLoading,
		isError: error
	};
};

